<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>老婆生日快乐</title>
<style>
body {
	font-family: 微软雅黑;
}
</style>
<script>
var img;//奖品
var other;//附赠
function lottery() {
	document.getElementById("lottery-show-append").innerHTML = '';
	var timer = setInterval(function (){randomData()},50);
	setTimeout(function(){stop(timer)},5000);//定时停止
}
function randomData() {
	var i = Math.random()*2;
	if (i > 1) {
		img = "zuanjie.jpg";
		other ="dangao.jpg";
	} else {
		img = "dangao.jpg";
		other ="zuanjie.jpg";
	}
	createHTML(img);
}
function createHTML(img) {
	var html = "<span style='color:red'>老婆的礼物是：<\/span></br><img style='width:200px; height:200px' src='" + img + "'></img>";
	document.getElementById("lottery-show").innerHTML= html;
}
function stop(timer) {
	clearInterval(timer);
	var html = "<span style='color:red'>OK，就是它了：<\/span></br><img style='width:200px; height:200px' src='" + img + "'></img>";
	document.getElementById("lottery-show").innerHTML= html;
	setTimeout(function(){alert("等等...");alert("嘻嘻...");appendOther()},1000);
}
function appendOther() {
	var appendHtml = "<span style='color:green'>买一送一啦o(∩_∩)o </span>，。</br><img style='width:200px; height:200px' src='" + other + "'></img>"
	document.getElementById("lottery-show-append").innerHTML= appendHtml;
	setTimeout(function(){alert("再等等...还有.....");openRose()},1000);
}
function openRose() {
	window.open("rose.html", '', 'height=800, width=600,location=no,top=20,left=300');
}

</script>
</head>
<body>
<a style="margin-bottom:20px " href="birthday2.html"><img src="xiu.jpg"></img>人家又想回去</a></br>

<div style="margin-top:20px">
<span>所以，我想了一个笨办法~抓阄~<img src="baobao.gif" ></img></span></br>
<span>简单说，就是抽到什么，就给老婆送什么~</span></br>
<span>老婆，<span style="cursor:pointer; color:blue" onclick="lottery()">快来试试~<img src="deyi.jpg" ></img></span></span>
<div  style="text-align:center;margin-top:30px"id="lottery-show"></div>
<div style="text-align:center;margin-top:30px"id="lottery-show-append"></div>
</div>

</body>
</html>